*** Settings ***
Documentation           通过Redfish获取pciedevice的processors信息
Resource                ../../test_function/redfish/redfish.robot
Library                 RequestsLibrary
Library                 Collections
Library                 BuiltIn
Suite Setup             Create REDFISH_GET Session
Suite Teardown          Delete All Sessions

*** Variables ***
${processors_id}        1
${INPUT_URI}            /Systems/${SYSTEM_ID}/Processors/${processors_id}

*** Test Cases ***
Get Processors Via Redfish
    [Documentation]    通过Redfish获取pciedevice的processors信息
    [Tags]    Get_Processors_Via_Redfish
    # 发送GET请求
    ${rsp}=    Run Keyword And Ignore Error    GET On Session    redfish_get    ${INPUT_URI}

    Run Keyword If     '${rsp[0]}' == 'FAIL'    Fail    msg=获取processors失败: ${rsp[1]}

    # 验证响应状态码
    Should Be Equal As Strings    ${rsp[1].status_code}    200    msg=预期状态码200,实际收到${rsp[1].status_code}

    # 打印响应内容
    Log    ${rsp[1].json()}    level=INFO

    # 验证processor的架构内容：ARM
    ${processor_settings}=    Set Variable    ${rsp[1].json()}
    ${architecture_name}=    Set Variable    ARM

    # 检查响应中是否包含ARM
    Should Be Equal As Strings    ${processor_settings['ProcessorArchitecture']}    ${architecture_name}
    Log    processor的架构内容为: ${processor_settings['ProcessorArchitecture']}    level=INFO
